#ifndef CFG_H
#define CFG_H

#include <string>
#include <list>
#include <map>

class XmmsCdinfo;

typedef std::pair<std::string, std::list<std::string> > nvpair_t;
typedef std::map <std::string, std::list<std::string> > nvpairs_t;

struct uri_t
{
	std::string scheme;
	std::string host;
	std::string port;
	std::string path;
};

class Cfg
{
	public:
	static std::string getPath();
	void setPairs(const char* section, const nvpairs_t newdata);
	void setPairs(const std::string section, const nvpairs_t newdata);
	nvpairs_t getPairs(const std::string section);

	static uri_t parseUri(const std::string uri);
	static bool ensurePath(const std::string path);

	private:
	std::map<std::string, nvpairs_t> data;

	friend class XmmsCdinfo;

	bool load();
	void save();
};

#endif /* CFG_H */
